feat(lambda-rs): Add support for indexed draw commands#72
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces indexed draw command support to the lambda-rs rendering engine, enabling more efficient rendering through index buffers and multiple vertex buffer configurations. The changes add a complete API surface for indexed geometry while maintaining backward compatibility with existing non-indexed draw workflows.
- Adds engine-level
IndexFormatenum andDrawIndexedcommand with validation - Introduces explicit instance ranges to both
DrawandDrawIndexedcommands (default0..1preserves single-instance behavior) - Implements comprehensive validation for index buffer formats, buffer types, and draw command ordering
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/lambda-rs/src/render/command.rs |
Adds IndexFormat enum with platform mapping and updates Draw/DrawIndexed signatures to include instance ranges |
crates/lambda-rs/src/render/mod.rs |
Implements validation logic for index buffers, draw commands, and device limits; adds tracking for bound index buffers and current pipeline |
crates/lambda-rs/src/render/pipeline.rs |
Adds buffer type validation in pipeline builder and device limit checks for vertex buffers/attributes |
crates/lambda-rs-platform/src/wgpu/render_pass.rs |
Updates platform layer draw methods to accept instance ranges |
crates/lambda-rs-platform/src/wgpu/gpu.rs |
Exposes max_vertex_buffers and max_vertex_attributes device limits |
crates/lambda-rs/examples/*.rs |
Updates all examples to include instances: 0..1 in Draw commands |
crates/lambda-rs/examples/indexed_multi_vertex_buffers.rs |
New example demonstrating indexed draws with separate position and color vertex buffers |
docs/tutorials/indexed-draws-and-multiple-vertex-buffers.md |
New comprehensive tutorial covering indexed geometry implementation (has type error in example code) |
docs/specs/indexed-draws-and-multiple-vertex-buffers.md |
Complete specification document for indexed draw feature with API surface, validation rules, and performance guidance |
tools/obj_loader/src/main.rs |
Updates obj loader to use new Draw signature with instances field |
docs/tutorials/*.md |
Updates existing tutorial code examples to include instances field |
.gitignore |
Adds docs/plans/ to ignored directories |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.